﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AliceSkill : SkillBase
{
    public float magnifyRatio = 2f;
    public float slowRatio = 0.5f;
    public PlayerController playerController;

    public override void Cast()
    {
        if (!isInCooldown())
        {
            lastCastTime = Time.time;
            StartCoroutine(SkillCountdown());
        }
    }

    public override void skillStart()
    {
        Debug.Log("skill start");
        transform.localScale = new Vector3(magnifyRatio, magnifyRatio, 1);

        if (transform.childCount>0)
            transform.GetChild(0).localScale = new Vector3(1.5f/magnifyRatio, 1.5f / magnifyRatio, 1);
        playerController.m_speed *= slowRatio;
        GetComponent<PlayerStatus>().isCostingStamina = false;
    }
    public override void skillEnd()
    {
        Debug.Log("skill end");
        transform.localScale = new Vector3(1.6f, 1.6f, 1);
        if (transform.childCount > 0)
            transform.GetChild(0).localScale = new Vector3(1.5f/1.6f, 1.5f / 1.6f, 1);
        playerController.m_speed /= slowRatio;
        GetComponent<PlayerStatus>().isCostingStamina = true;

    }

    // Start is called before the first frame update
    void Start()
    {
        playerController = GetComponent<PlayerController>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
